<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-CN"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="Content-Language" content="zh-CN"><link href="stylesheet.css" media="all" rel="stylesheet" type="text/css">
<title>SPI_saveplan</title>
<script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?d286c55b63a3c54a1e43d10d4c203e75"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script>
</head><body class="REFENTRY">
<div>
<table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><th colspan="5" align="center" valign="bottom">PostgreSQL 8.2.3 中文文档</th></tr>
<tr><td width="10%" align="left" valign="top"><a href="spi-spi-cursor-close.html" accesskey="P">后退</a></td><td width="10%" align="left" valign="top"><a href="spi-spi-cursor-close.html">快退</a></td><td width="60%" align="center" valign="bottom"></td><td width="10%" align="right" valign="top"><a href="spi.html">快进</a></td><td width="10%" align="right" valign="top"><a href="spi-interface-support.html" accesskey="N">前进</a></td></tr>
</table>
<hr align="LEFT" width="100%"></div>
<h1><a name="SPI-SPI-SAVEPLAN"></a>SPI_saveplan</h1>
<div class="REFNAMEDIV"><a name="AEN42776"></a><h2>函数名</h2>SPI_saveplan&nbsp;--&nbsp;保存一个规划</div>
<a name="AEN42779"></a>
<div class="REFSYNOPSISDIV"><a name="AEN42781"></a><h2>原型</h2>
<pre class="SYNOPSIS">void * SPI_saveplan(void * <tt class="PARAMETER">plan</tt>)</pre>
</div>
<div class="REFSECT1"><a name="AEN42784"></a><h2>描述</h2>
<p><code class="FUNCTION">SPI_saveplan</code> 在内存里保存一个传递进来的规划(用 <code class="FUNCTION">SPI_prepare</code> 准备的)，避免它被 <code class="FUNCTION">SPI_finish</code> 和事务管理器释放，并且返回一个指向保存的规划的指针。这样就给你在当前会话里的随后的调用中复用这个预备规划的能力。</p>
</div>
<div class="REFSECT1"><a name="AEN42790"></a><h2>参数</h2>
<div class="VARIABLELIST">
<dl>
<dt><tt class="LITERAL">void * <tt class="PARAMETER">plan</tt></tt></dt>
<dd><p>要保存的规划</p></dd>
</dl>
</div>
</div>
<div class="REFSECT1"><a name="AEN42799"></a><h2>返回值</h2>
<p>指向保存的规划的指针；如果不成功则为 <tt class="SYMBOL">NULL</tt> 。出错的时候，像下面这样设置 <tt class="VARNAME">SPI_result</tt> ：</p>
<div class="VARIABLELIST">
<dl>
<dt><tt class="SYMBOL">SPI_ERROR_ARGUMENT</tt></dt>
<dd><p>如果 <tt class="PARAMETER">plan</tt> 是 <tt class="SYMBOL">NULL</tt></p></dd>
<dt><tt class="SYMBOL">SPI_ERROR_UNCONNECTED</tt></dt>
<dd><p>如果从一个未连接的过程中调用</p></dd>
</dl>
</div>
</div>
<div class="REFSECT1"><a name="AEN42817"></a><h2>注意</h2>
<p>如果会话过程中，预备规划引用的一个对象(一个表、函数等等)被删除，那么 <code class="FUNCTION">SPI_execute_plan</code> 执行此规划的结果将不可预期。</p>
</div>
<div>
<hr align="LEFT" width="100%">
<table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td width="33%" align="left" valign="top"><a href="spi-spi-cursor-close.html" accesskey="P">后退</a></td><td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">首页</a></td><td width="33%" align="right" valign="top"><a href="spi-interface-support.html" accesskey="N">前进</a></td></tr>
<tr><td width="33%" align="left" valign="top">SPI_cursor_close</td><td width="34%" align="center" valign="top"><a href="spi-interface.html" accesskey="U">上一级</a></td><td width="33%" align="right" valign="top">接口支持函数</td></tr>
</table>
</div>
</body></html>